package pers.cj.pdos.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ImgUtil {
    /**
     * 创建文件名称 内容：时间戳+随机数
     *
     * @param @return
     * @throws
     */
    public static synchronized String getFileName(String prefix, String imgFormat) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String timeStr = sdf.format(new Date());
        String str = AlgorithmUtil.getCode(8,null,false,true);
        String name = prefix + "-" + timeStr + "-" + str + "." + imgFormat;
        return name;
    }
}
